<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="ligerForm" action="">
				<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
						<span class="title">归档申请</span>
					</div>
					<div class="fieldBox col_50">
						<div class="label">合同号</div>
						<div class="field">
						<a href="javascript:detailPrjBtn( ${mgr.prjId})">
						<font color="blue">	${mgr.contractNo}</font>
						</a>
							
							
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">交接单名称</div>
						<div class="field">
						
								${mgr.arcReceiptName}
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">版本号</div>
						<div class="field">${mgr.versioni}
						</div>
					</div>
					
					<!-- 筛选条件 -->
					<jsp:include page="arcMgrSS.jsp" flush="true" />
					
					<div class="caption">
						<span class="title">合同资料、承租人资料、担保人资料</span>
						${mgr.cstNm} ${mgr.contractNo}<font color="red">(${mgr.storageStatusConNm}|${mgr.eleStorageStatusConNm})</font>	
					</div>
					
					<div class="fieldBox col_100">
						<div style="width: 100%; ">
							<table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40 cellPadding=1 width="100%" align=center border=1> 
							<thead>
								<tr style="background:#E7FEF4">
									<th  style="text-align: center;width:2%;"></th>
									<th  style="text-align: center;width:7%">权证类别</th>
									<th  style="text-align: center;width:25%">权证名称</th>
									<th  style="text-align: center;width:5%">资料类型</th>
									<th  style="text-align: center;width:5%">是否必须</th>
									<th  style="text-align: center;width:5%">扫描件</th>
									
									<th  style="text-align: center;width:8%">操作人</th>
									<th  style="text-align: center;width:8%">操作时间</th>
									<th  style="text-align: center;width:6%">归档地点</th>
									<th  style="text-align: center;width:9%">要求归档份数</th>
									<th  style="text-align: center;width:8%">实际归档份数</th>
									<th  style="text-align: center;width:18%">本次归档份数</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${cList}" var="item" varStatus="status">
									<tr>
									<td  style="text-align: center; height:20px;">${status.index+1}</td>
									<td style="text-align: center; ">${item.fileFlagNm }</td>
									<td style="text-align: center; ">${item.fileName }</td>
									<td style="text-align: center; ">${item.dossierTempNm }</td>
									<td style="text-align: center; ">${item.ischoiceNm }</td>
									<td  style="text-align: center;">${item.arcReceiptDetailVO.isScanRequireNm }</td>
									<td  style="text-align: center;">${item.upUsrCdNm }</td>
									<td  style="text-align: center;"><fmt:formatDate type="date" value="${item.upUsrTm }"/></td>
									<td style="text-align: center; ">${item.arcReceiptDetailVO.arcPlaceNm }</td>
									<td style="text-align: center; ">${item.dossierCount }</td>
									<td  style="text-align: center; ">${item.checkCount }
									</td>
									<td style="text-align: center;">
									<c:if test="${item.dossierTemp =='3' and item.filePath != null}">
			               			<a  target="_blank" href="${item.filePath }" >查看</a>
			               			</c:if>
			               			<!-- 如果是连接附件 -->
			               			<c:if test="${item.ulFlag=='1'}">
											<div style="display: none;">
											<input type="text"  id="ele_${item.id}" name="ele_${item.id}" value="${item.eleId}">
									</div></c:if>
			               			<!-- 如果不是电子的，并且归档中的0，显示归档分数 -->
			               			<c:set var="dossierCount"  value="0"/>
			               			<c:if test="${item.dossierCount-item.checkCount>0 }">
			               			<c:set var="dossierCount"  value="${item.dossierCount-item.checkCount}"/>
			               			</c:if>
				               		<c:if test="${item.dossierTemp !='3' }">
									<input disabled id="thisCount_p_${item.id}" name="thisCount_p_${item.id}" value="${dossierCount}"
									  type="text"   class="ui-textbox"  ligerui="width: 60" >
									</c:if>
									</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						</div>
					</div>
					
					<div class="caption">
						<span class="title">权证资料</span>						
					</div>
					<c:forEach items="${pList}" var="mgrvo">
					<div class="fieldBox col_100">
					<table style="BORDER-COLLAPSE: collapse;" borderColor=#ECECEC height=25 cellPadding=1 width="100%" align=center border=1> 
						<tr >
						<td >
						<a href="javascript:detailBtn(${mgrvo.mvo.paySchId},${mgrvo.mvo.prjPrdId},${mgrvo.mvo.prjId})">
						<font color="blue">${mgrvo.mvo.paySchNo}</font></a>&nbsp;<font color="red">(${mgrvo.mvo.storageStatusNm}|${mgrvo.mvo.eleStorageStatusNm})</font>&nbsp;&nbsp;
						车架号：${mgrvo.mvo.vin}&nbsp;&nbsp;&nbsp;
						挂靠公司：${mgrvo.mvo.lnkCompNm}&nbsp;&nbsp;&nbsp;
						</td>
						<td align=right>
						<a align=right href="javascript:commShowFlow('${mgrvo.mvo.buOrgCd}','${mgrvo.mvo.bizFlag}','${mgrvo.mvo.prInsId}',${mgrvo.mvo.capId})">
						<font  color="blue" >${mgrvo.mvo.prInsNo}</font>
						</a>
						</td></tr></table>
						<div style="width: 100%; ">
							 <table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40 cellPadding=1 width="100%" align=center border=1> 
							<thead>
								<tr style="background:#E7FEF4">
									<th  style="text-align: center;width:2%;"></th>
									<th  style="text-align: center;width:7%">权证类别</th>
									<th  style="text-align: center;width:25%">权证名称</th>
									<th  style="text-align: center;width:5%">资料类型</th>
									<th  style="text-align: center;width:5%">是否必须</th>
									<th  style="text-align: center;width:5%">扫描件</th>
									
									<th  style="text-align: center;width:8%">操作人</th>
									<th  style="text-align: center;width:8%">操作时间</th>
									<th  style="text-align: center;width:6%">归档地点</th>
									<th  style="text-align: center;width:9%">要求归档份数</th>
									<th  style="text-align: center;width:8%">实际归档份数</th>
									<th  style="text-align: center;width:18%">本次归档份数</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${mgrvo.ppList}" var="item" varStatus="status">
									<tr>
									<td  style="text-align: center; height:20px;">${status.index+1}</td>
									<td  style="text-align: center; ">${item.fileFlagNm }</td>
									<td  style="text-align: center; ">${item.fileName }</td>
									<td  style="text-align: center; ">${item.dossierTempNm }</td>
									<td  style="text-align: center; ">${item.ischoiceNm }</td>
									<td  style="text-align: center;">${item.arcReceiptDetailVO.isScanRequireNm }</td>
									<td  style="text-align: center;">${item.upUsrCdNm }</td>
									<td  style="text-align: center;"><fmt:formatDate type="date" value="${item.upUsrTm }"/></td>
									<td style="text-align: center; ">${item.arcReceiptDetailVO.arcPlaceNm }</td>
									<td  style="text-align: center; ">${item.dossierCount }</td>
									<td  style="text-align: center; ">${item.checkCount }
									</td>
									<td  style="text-align: center;">
									<c:if test="${item.dossierTemp =='3' and item.filePath != null}">
			               			<a  target="_blank" href="${item.filePath }" >查看</a>
			               			</c:if>
			               			<!-- 如果是连接附件 -->
			               			<c:if test="${item.ulFlag=='1'}">
											<div style="display: none;">
											<input type="text"  id="ele_${item.id}" name="ele_${item.id}" value="${item.eleId}">
									</div></c:if>
			               			<!-- 如果不是电子的-->
			               			<c:set var="dossierCount"  value="0"/>
			               			<c:if test="${item.dossierCount-item.checkCount>0 }">
			               			<c:set var="dossierCount"  value="${item.dossierCount-item.checkCount}"/>
			               			</c:if>
				               		<c:if test="${item.dossierTemp !='3' }">
									<input disabled id="thisCount_p_${item.id}" name="thisCount_p_${item.id}" value="${dossierCount}"
									  type="text"   class="ui-textbox"  ligerui="width: 60" >
									</c:if>
									</td>
								
								<tr>
								</c:forEach>
							</tbody>
						</table>
						</div>
					</div>
					</c:forEach>
					
					<jsp:include page="arcPostAdd.jsp" flush="true" />
					<jsp:include page="arcPostList.jsp" flush="true" />
				</div>
				
				<div class="btnsBox"  style="text-align:center">
					
						<span id="saveBtn" class="sq-button sq-button-round"  onclick="save();">保存</span>
						
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
	//显示流程
    function commShowFlow(buOrgCd, _bizFlag,_pInstId,_businessKey){
		var _audStsCd="2";
        if(StringUtils.isEmpty(_pInstId)){
            UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
            return;
        }
        var _formUrl = "/capPay/flow/toAdditionalInfoPage.do?version=2@@capPayId=";
        if(StringUtils.isNotEmpty(buOrgCd) && buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){//汽车金融工行业务
            if(StringUtils.isNotEmpty(rowdata.bizFlag) && rowdata.bizFlag == '2'){
            	_formUrl = "/capital/capPayInfo/toAddPage.do?accCtrl=1@@ctrlKey=3@@bizFlag="+_bizFlag+"@@id=";
            }else{
            	_formUrl = "/capital/capPayInfo/toAddPage.do?accCtrl=1@@ctrlKey=3@@id=";  //汽车金融
            }
        }else if(StringUtils.isNotEmpty(buOrgCd) && buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZC){//专车事业部
        	_formUrl="/capital/capPayInfo/toAddPageBySpecialCar.do?entrance=0@@id=";
        }else{
        	
        }
        
        
        var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
        Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
    </script>
	<script type="text/javascript">
	 	
		var grid;
		
		$(function() {
			$("#ligerForm").ligerForm({
				validate: true
			});
			
			//initGrid();//初始化交接单明细
	    });
		
		
		//保存
		function save(){
			
			var ligerForm = liger.get("ligerForm");
			if (!ligerForm.valid()) {
				$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; 
			}
			//if(!checkPost()){
			//	return ;
			//}
			var data = ligerForm.getData();//主表数据
			//data["cjson"] = '${cjson}';
			//data["pjson"] = '${pjson}';
			//明细数据JSON.stringify(grid.getData());
			//alert(JSON.stringify(data));
			//alert(JSON.stringify(grid.getData()));
			//alert(JSON.stringify($("#ligerForm").serialize()));
			//console.log((JSON.stringify(data)));
			
			var wait_dialog = null;
			
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: '<%=path%>/archive/arcApplyMain/modifyFlowNew.do?flag=${flag}&id=${id}',
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
							$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
							//if(id == "") {
							//	Remove_navTab();//新增，关闭当前页面
							//}
					}else{
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				},error:function (XMLHttpRequest, textStatus, errorThrown) { 
					wait_dialog.close();
					$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
				} 
			});
		}
		
	</script>
</body>
</html>